package com.example.demo.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.entity.ExamHistory;
import com.example.demo.mapper.ExamHistoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExamHistoryService {
  @Autowired
  ExamHistoryMapper examHistoryMapper;

  public List<ExamHistory> getUserExamHistory(String userId){
    return examHistoryMapper.selectList(new QueryWrapper<ExamHistory>().eq("user_id",userId));
  }

  public int addExamHistory(ExamHistory examHistory){
    return examHistoryMapper.insert(examHistory);
  }

  public int getUserExamHistoryCount(String userId){
    return examHistoryMapper.selectCount(new QueryWrapper<ExamHistory>().eq("user_id",userId));
  }

}
